Skip to content

GH-16187: fix ReflectionClass::__toString() with packed properties hash table #16192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

DanielEScherzer
Copy link
Member

No description provided.

@nielsdos
Copy link
Member

nielsdos commented Oct 3, 2024

Looks good, but please target branch PHP-8.2. Bug fixes should always target the lowest applicable supported branch.

@DanielEScherzer
Copy link
Member Author

DanielEScherzer commented Oct 4, 2024

Looks good, but please target branch PHP-8.2. Bug fixes should always target the lowest applicable supported branch.

Done, sorry for the spam of requesting review from code owners, when I switched the base branch Github included all of the commits since 8.2 until I force pushed (next time I'll try force pushing first)

@nielsdos
Copy link
Member

nielsdos commented Oct 4, 2024

It's probably a good idea to echo the result of __toString.

@DanielEScherzer
Copy link
Member Author

It's probably a good idea to echo the result of __toString.

Normally I would agree, but

  • there are no actual properties in the output, and I have no idea if there should be, this was just about the segfault
  • the output is pretty big
Object of class [ <internal:SimpleXML> <iterateable> class SimpleXMLElement implements Stringable, Countable, RecursiveIterator, Traversable, Iterator ] {

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Dynamic properties [0] {
  }

  - Methods [21] {
    Method [ <internal:SimpleXML> public method xpath ] {

      - Parameters [1] {
        Parameter #0 [ <required> string $expression ]
      }
      - Tentative return [ array|false|null ]
    }

    Method [ <internal:SimpleXML> public method registerXPathNamespace ] {

      - Parameters [2] {
        Parameter #0 [ <required> string $prefix ]
        Parameter #1 [ <required> string $namespace ]
      }
      - Tentative return [ bool ]
    }

    Method [ <internal:SimpleXML> public method asXML ] {

      - Parameters [1] {
        Parameter #0 [ <optional> ?string $filename = null ]
      }
      - Tentative return [ string|bool ]
    }

    Method [ <internal:SimpleXML> public method saveXML ] {

      - Parameters [1] {
        Parameter #0 [ <optional> ?string $filename = null ]
      }
      - Tentative return [ string|bool ]
    }

    Method [ <internal:SimpleXML> public method getNamespaces ] {

      - Parameters [1] {
        Parameter #0 [ <optional> bool $recursive = false ]
      }
      - Tentative return [ array ]
    }

    Method [ <internal:SimpleXML> public method getDocNamespaces ] {

      - Parameters [2] {
        Parameter #0 [ <optional> bool $recursive = false ]
        Parameter #1 [ <optional> bool $fromRoot = true ]
      }
      - Tentative return [ array|false ]
    }

    Method [ <internal:SimpleXML> public method children ] {

      - Parameters [2] {
        Parameter #0 [ <optional> ?string $namespaceOrPrefix = null ]
        Parameter #1 [ <optional> bool $isPrefix = false ]
      }
      - Tentative return [ ?SimpleXMLElement ]
    }

    Method [ <internal:SimpleXML> public method attributes ] {

      - Parameters [2] {
        Parameter #0 [ <optional> ?string $namespaceOrPrefix = null ]
        Parameter #1 [ <optional> bool $isPrefix = false ]
      }
      - Tentative return [ ?SimpleXMLElement ]
    }

    Method [ <internal:SimpleXML, ctor> public method __construct ] {

      - Parameters [5] {
        Parameter #0 [ <required> string $data ]
        Parameter #1 [ <optional> int $options = 0 ]
        Parameter #2 [ <optional> bool $dataIsURL = false ]
        Parameter #3 [ <optional> string $namespaceOrPrefix = "" ]
        Parameter #4 [ <optional> bool $isPrefix = false ]
      }
    }

    Method [ <internal:SimpleXML> public method addChild ] {

      - Parameters [3] {
        Parameter #0 [ <required> string $qualifiedName ]
        Parameter #1 [ <optional> ?string $value = null ]
        Parameter #2 [ <optional> ?string $namespace = null ]
      }
      - Tentative return [ ?SimpleXMLElement ]
    }

    Method [ <internal:SimpleXML> public method addAttribute ] {

      - Parameters [3] {
        Parameter #0 [ <required> string $qualifiedName ]
        Parameter #1 [ <required> string $value ]
        Parameter #2 [ <optional> ?string $namespace = null ]
      }
      - Tentative return [ void ]
    }

    Method [ <internal:SimpleXML> public method getName ] {

      - Parameters [0] {
      }
      - Tentative return [ string ]
    }

    Method [ <internal:SimpleXML, prototype Stringable> public method __toString ] {

      - Parameters [0] {
      }
      - Return [ string ]
    }

    Method [ <internal:SimpleXML, prototype Countable> public method count ] {

      - Parameters [0] {
      }
      - Tentative return [ int ]
    }

    Method [ <internal:SimpleXML, prototype Iterator> public method rewind ] {

      - Parameters [0] {
      }
      - Tentative return [ void ]
    }

    Method [ <internal:SimpleXML, prototype Iterator> public method valid ] {

      - Parameters [0] {
      }
      - Tentative return [ bool ]
    }

    Method [ <internal:SimpleXML, prototype Iterator> public method current ] {

      - Parameters [0] {
      }
      - Tentative return [ SimpleXMLElement ]
    }

    Method [ <internal:SimpleXML, prototype Iterator> public method key ] {

      - Parameters [0] {
      }
      - Tentative return [ string ]
    }

    Method [ <internal:SimpleXML, prototype Iterator> public method next ] {

      - Parameters [0] {
      }
      - Tentative return [ void ]
    }

    Method [ <internal:SimpleXML, prototype RecursiveIterator> public method hasChildren ] {

      - Parameters [0] {
      }
      - Tentative return [ bool ]
    }

    Method [ <internal:SimpleXML, prototype RecursiveIterator> public method getChildren ] {

      - Parameters [0] {
      }
      - Tentative return [ ?SimpleXMLElement ]
    }
  }
}

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, no properties is normal but the output is indeed long.
Anyway patch LGTM, I'll merge it tomorrow morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion failure in ext/reflection/php_reflection.c:487
2 participants